package view
{
	import flash.display.Graphics;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.geom.Rectangle;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	/**
	 * 升级提示框 
	 * @author 1
	 * 
	 */	
	public class PromptBox extends Sprite{
		/**
		 * 升级提示框的单历 
		 */		
		private static var instence:PromptBox;
		
		/**
		 * 用于设置升级选择器的visiable属性; 
		 */		
		public var isShow:Boolean = false;
		
		/**
		 * 弹出框 
		 * 
		 */
		private var box:Sprite;
		
		/**
		 * textField 
		 * 
		 */
		private var describeBox:TextField;
		private var titleBox:TextField;
		
		/**
		 * 标题样式 
		 */		
		private var titleFormat:TextFormat;
		
		/**
		 * 描述 样式
		 */		
		private var describeFormat:TextFormat;
		
		private var _textTitle:String;
		
		private var _textDescribe:String;
		
		/**
		 * 塔的信息描述 
		 * 
		 */		
		public function PromptBox(){
			addBox();
			addTextField();
		}
		
		
		
		private function addBox():void{
			box = new Sprite();
			addChild(box);
			var g:Graphics = box.graphics;
			g.beginFill(0x0,.5);
			g.lineStyle(1,0xff9900,.5);
			g.drawRoundRect(0,0,150,120,20,20);
			g.endFill();
			
		}
		
		private function addTextField():void{
			titleBox = new TextField();
			describeBox = new TextField();
			box.addChild(titleBox);
			box.addChild(describeBox);
			
			
			titleBox.x = 10;
			titleBox.y = 5;
			
			describeBox.x = 10;
			describeBox.y = 35;
			
			titleBox.width = box.width-20;
			describeBox.width = box.width-20;
			describeBox.wordWrap = true;
			
			describeFormat = new TextFormat("宋体",12,0xffffff,true);
			titleFormat = new TextFormat("宋体",14,0xFDDA2E,true);
			describeBox.defaultTextFormat = describeFormat;
			titleBox.defaultTextFormat = titleFormat;
			titleBox.text = "TextBox";
			describeBox.text = "DescribeBox";
			
		}
		
		/**
		 * 单历 
		 * @return 
		 * 
		 */		
		public static function getInstence():PromptBox{
			if(!instence) instence = new PromptBox();
			return instence;
		}
		
		/**
		 * 建筑物选择器在显示和隐藏两种状态之间切换; 
		 * 
		 */		
		public function orShow():void{
			isShow = ! isShow;
			visible = isShow;
		}

		/**
		 * 获取标题 
		 */
		public function get textTitle():String{
			return _textTitle;
		}

		/**
		 * @写入标题 
		 */
		public function set textTitle(value:String):void{
			_textTitle = value;
			titleBox.text = textTitle
		}

		/**
		 * 获取描述 
		 */
		public function get textDescribe():String{
			return _textDescribe;
		}

		/**
		 * @写入描述 
		 */
		public function set textDescribe(value:String):void{
			_textDescribe = value;
			titleBox.text = textDescribe;
		}
		
		
		
	}
}